import request from "@/utils/request";
import type { UserParamsType, UserLoginResponseData, UserInfo } from "./type";
enum API {
  LOGIN_URL = "/admin.Login/login",
  USERINFO_URL = "/admin.UserCenter/info",
  LOGOUT_URL = "/admin.Login/logout",
  EDIT_UINFO = "/admin.UserCenter/edit",
  EDIT_PWD = "/admin.UserCenter/pwd"
}

export const reqLogin = (data: UserParamsType) => {
  return request.post(API.LOGIN_URL, data);
};

export const reqLogout = () => request.get<any, any>(API.LOGOUT_URL);

export const reqUserInfo = () => request.get<any, UserInfo>(API.USERINFO_URL);

export const reqEditUserInfo = (username:any,nickname:any,phone:any,email:any)=>request.post<any,any>(API.EDIT_UINFO+`?username=${username}&nickname=${nickname}&phone=${phone}&email=${email}`)

export const reqEditPwd = (password_old:any,password_new:any)=>request.post<any,any>(API.EDIT_PWD+`?password_old=${password_old}&password_new=${password_new}`)